package Vue;

import java.awt.BorderLayout;
import java.awt.GraphicsConfiguration;
import java.awt.GridLayout;
import java.awt.HeadlessException;
import java.awt.LayoutManager;

import javax.swing.BoxLayout;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

import Controller.Catcatgo;


public class Fenetre  extends JFrame{

	public Catcatgo controller;
	public Recherche rech;
	public Resultat resultat;
	public Fenetre(Catcatgo cont) throws HeadlessException {
		super();
		controller = cont;
		this.setTitle("Cat Cat Go");
		this.pack();
		this.setDefaultLookAndFeelDecorated(true);
		this.setExtendedState(this.MAXIMIZED_BOTH);
		this.setLocationRelativeTo(null);
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);             
		this.setVisible(true);
		// TODO Auto-generated constructor stub
	}

	public Fenetre(GraphicsConfiguration gc) {
		super(gc);
		// TODO Auto-generated constructor stub
	}

	public Fenetre(String title, GraphicsConfiguration gc) {
		super(title, gc);
		// TODO Auto-generated constructor stub
	}

	public Fenetre(String title) throws HeadlessException {
		super(title);
		// TODO Auto-generated constructor stub
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Fenetre fen = new Fenetre(new Catcatgo());
		fen.rech = new Recherche(fen);
		fen.resultat = new Resultat();
		JPanel panelPrincipal = new JPanel();
		JPanel panelCentral = new JPanel(new BorderLayout());
		panelPrincipal.setLayout(new BoxLayout(panelPrincipal, BoxLayout.PAGE_AXIS));
		//Au centre
		panelCentral.add(fen.resultat, BorderLayout.CENTER);
		//Au nord
		panelCentral.add(new JLabel("Resultats :"), BorderLayout.NORTH);
		panelPrincipal.add(fen.rech);
		panelPrincipal.add(panelCentral);
		fen.getContentPane().add(panelPrincipal);
		fen.setVisible(true);		
		fen.controller.ajouterObservateur(fen.resultat);


	}

}
